<!DOCTYPE html>
<html lang="en">
<link rel="stylesheet" th:href="@{/assets/css/colorbox.css}" />
<!--<link rel="stylesheet" th:href="@{/css/public.css}" />-->
<head th:include="fragments/head::header" />
<body>
<div th:include="fragments/top::top"></div>
<div class="main-container" id="main-container">
    <div class="main-container-inner">
        <div th:include="fragments/left::left" class="sidebar" id="sidebar"></div>
        <div class="main-content">
            <div class="breadcrumbs" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li><i class="icon-home home-icon"></i> <a href="#">首页</a></li>
                    <li><a href="#">用户管理</a></li>
                    <li><a href="/member/list">用户列表</a></li>
                    <!--<li class="active">内容列表</li>-->
                </ul>
            </div>

            <div class="page-content">

                <h3 class="header smaller lighter blue">用户信息</h3>
                <div id="ulId" class=""></div>
                <br/>
                <form method="post" id="edit">
                    <!--<input type="hidden" name="id" id="id" th:value="${user.id}"/>-->
                    <div  class="tab-pane fade in active">
                        <div class="container">
                            <div class="form-horizontal">
                                <div class="form-group" style="height:29px">
                                    <label class="col-sm-3 control-label no-padding-right blue" for="username"> 用户名称：</label>
                                    <input class="col-sm-1" style="width: 150px" id="username" name="username" />
                                    <!--<label class="col-sm-3 control-label no-padding-right blue"> 操作人：</label>-->
                                    <!--<input class="col-sm-1" style="width: 150px" id="operator" name="operator" disabled="disabled" th:value="${current!=null}? ${current.username}"/>-->
                                    <label class="col-sm-3 control-label no-padding-right blue"> 密码：</label>
                                    <input class="col-sm-1" style="width: 150px" id="password" name="password"/>
                                </div>
                                <div class="form-group" style="height:29px">
                                    <label class="col-sm-3 control-label no-padding-right blue" for="username"> 内网工号：</label>
                                    <input class="col-sm-1" style="width: 150px" id="oaid" name="oaid"/>
                                </div>
                                <!--<div class="form-group" style="height:29px">-->
                                    <!--<label class="col-sm-3 control-label no-padding-right blue"> 分配角色：</label>-->
                                    <!--<input class="col-sm-1" style="width: 150px" name="roleTree" th:value="树形菜单选择角色" onclick="selectRole()"/>-->
                                    <!--<label class="col-sm-3 control-label no-padding-right blue" for="operatorDate"> 操作日期：</label>-->
                                    <!--<input class="col-sm-1" style="width: 150px" name="operatorDate" disabled="disabled" value=""/>-->
                                <!--</div>-->
                                <!--<div class="form-group" style="height:29px">-->
                                    <!--<label class="col-sm-3 control-label no-padding-right blue"> 分配小组：</label>-->
                                    <!--<input class="col-sm-1" style="width: 150px" name="roleTree" th:value="树形菜单选择角色" onclick="selectGroupRole()"/>-->
                                <!--</div>-->
                                <!--<div class="form-group" style="height:29px">-->
                                    <!--<label class="col-sm-3 control-label no-padding-right blue"> 是否是组负责人：</label>-->
                                    <!--<select type="" class="col-sm-1 form-control input-sm" name="isLeader" style="width:190px;height:25px;">-->
                                        <!--<option value="1" >是</option>-->
                                        <!--<option value="2" >否</option>-->
                                    <!--</select>-->
                                <!--</div>-->
                                <!--<div class="form-group" style="height:29px">-->
                                    <!--<label class="col-sm-3 control-label no-padding-right blue"> 工号：</label>-->
                                    <!--<input class="col-sm-1" style="width: 150px" disabled="disabled" name="jobNumber" value=""/>-->
                                <!--</div>-->
                                <!--<div class="form-group" style="height:29px">-->
                                    <!--<label class="col-sm-3 control-label no-padding-right blue" for="resultComment"> 备注：</label>-->
                                    <!--<input class="col-sm-2" id="resultComment" name="resultComment" style="width:560px;height:100px;" th:value="${applyResult!=null}? ${applyResult.resultComment}" required="required"/>-->
                                <!--</div>-->
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-primary" id="submits">保存</button>
                    </div>

                    <div id="alert" class="alert alert-success" style="display: none;" role="alert">
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                        <span id="alertText"></span>
                    </div>
                </form>

            </div>
        </div>

        <div th:include="fragments/bottom::bottom"></div>
    </div>

    <a href="#" id="btn-scroll-up"
       class="btn-scroll-up btn btn-sm btn-inverse"> <i
            class="icon-double-angle-up icon-only bigger-110"></i>
    </a>
</div>

<!-- Modal备注 -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">

        </div>
    </div>
</div>

<!-- Modal备注 -->
<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body">
                <h2 style="color: green" id="result">审核通过</h2>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                </button>
            </div>
        </div>
    </div>
</div>

<div th:include="fragments/js::js"></div>


<!-- page specific plugin scripts -->
<script th:src="@{/assets/js/jquery.dataTables.min.js}"></script>
<script th:src="@{/assets/js/jquery.dataTables.bootstrap.js}"></script>
<script th:src="@{/assets/js/temp.js}" charset="UTF-8"></script>
<script th:src="@{/business/user/edit.js}" charset="UTF-8"></script>
<!--图片查看器-->
<script th:src="@{/assets/js/jquery.colorbox-min.js}"></script>
<script th:src="@{/layer/layer.js}"></script>
<script type="text/javascript">
    $(function () {

        $("#submits").click(function () {

//            if ($("#add").valid()) {
            $.ajax({
                url: "/user/add",
                type: "post",
                data: $("#edit").serialize(),
                success: function (data) {
//                    if (data) {
//                        $(".alert-success").text("操作成功").show();
//                        $('#alert').attr('class',
//                            'alert alert-success').show();
//                        setTimeout("$('#alert').hide()", 2000);
//                        $("#myModal").modal("hide");
//
//                    } else {
//                        $('#alertText').text('操作失败');
//                        $('#alert').attr('class',
//                            'alert alert-danger').show();
//                        setTimeout("$('#alert').hide()", 2000);
//                        $("#myModal").modal("hide");
//                    }
                    if (data) {
                        layer.confirm('操作成功，是否跳转到列表页？', {
                            btn: ['确定','取消'] //按钮
                        }, function(){
                            location.href = '/user';
                        }, function(){
                            parent.layer.close();
                        });
                    } else {
                        layer.confirm('操作失败，请查看列表是否有该数据或是否添加访问权限！是否跳转到列表页？', {
                            btn: ['确定','取消'] //按钮
                        }, function(){
                            location.href = '/user';
                        }, function(){
                            parent.layer.close();
                        });
                    }
                }
            });
//            }
        })

        //监听modal关闭事件，清除整个页面的缓存数据
        $("#myModal").on("hidden.bs.modal", function () {
            $(this).removeData("bs.modal");
        });
    });
</script>
</body>
</html>
